package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUserWechatMapper;
import com.ruoyi.system.domain.SysUserWechat;
import com.ruoyi.system.service.ISysUserWechatService;

/**
 * 用户微信绑定Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-18
 */
@Service
public class SysUserWechatServiceImpl implements ISysUserWechatService 
{
    @Autowired
    private SysUserWechatMapper sysUserWechatMapper;

    /**
     * 查询用户微信绑定
     * 
     * @param wechatId 用户微信绑定主键
     * @return 用户微信绑定
     */
    @Override
    public SysUserWechat selectSysUserWechatByWechatId(Long wechatId)
    {
        return sysUserWechatMapper.selectSysUserWechatByWechatId(wechatId);
    }

    /**
     * 查询用户微信绑定列表
     * 
     * @param sysUserWechat 用户微信绑定
     * @return 用户微信绑定
     */
    @Override
    public List<SysUserWechat> selectSysUserWechatList(SysUserWechat sysUserWechat)
    {
        return sysUserWechatMapper.selectSysUserWechatList(sysUserWechat);
    }

    /**
     * 新增用户微信绑定
     * 
     * @param sysUserWechat 用户微信绑定
     * @return 结果
     */
    @Override
    public int insertSysUserWechat(SysUserWechat sysUserWechat)
    {
        sysUserWechat.setCreateTime(DateUtils.getNowDate());
        return sysUserWechatMapper.insertSysUserWechat(sysUserWechat);
    }

    /**
     * 修改用户微信绑定
     * 
     * @param sysUserWechat 用户微信绑定
     * @return 结果
     */
    @Override
    public int updateSysUserWechat(SysUserWechat sysUserWechat)
    {
        sysUserWechat.setUpdateTime(DateUtils.getNowDate());
        return sysUserWechatMapper.updateSysUserWechat(sysUserWechat);
    }

    /**
     * 批量删除用户微信绑定
     * 
     * @param wechatIds 需要删除的用户微信绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysUserWechatByWechatIds(Long[] wechatIds)
    {
        return sysUserWechatMapper.deleteSysUserWechatByWechatIds(wechatIds);
    }

    /**
     * 删除用户微信绑定信息
     * 
     * @param wechatId 用户微信绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysUserWechatByWechatId(Long wechatId)
    {
        return sysUserWechatMapper.deleteSysUserWechatByWechatId(wechatId);
    }

    /**
     * 根据微信OpenID查询用户微信绑定
     * 
     * @param openId 微信OpenID
     * @return 用户微信绑定
     */
    @Override
    public SysUserWechat selectSysUserWechatByOpenId(String openId)
    {
        return sysUserWechatMapper.selectSysUserWechatByOpenId(openId);
    }

    /**
     * 根据用户ID查询用户微信绑定
     * 
     * @param userId 用户ID
     * @return 用户微信绑定
     */
    @Override
    public SysUserWechat selectSysUserWechatByUserId(Long userId)
    {
        return sysUserWechatMapper.selectSysUserWechatByUserId(userId);
    }
}
